<?php

namespace App\Entities;

use App\Support\Database\Eloquent\UuidModel;

class DrawRecord extends UuidModel
{
    const EXCHANGED = 1;//已兑换
    const UN_EXCHANGED = 0;//未兑换

    protected $table = 'activity_records';

    protected $fillable = [
        'id',
        'activity_id',
        'prize_id',
        'name',
        'mobile',
        'openid',
        'number',
        'amount',
        'address',
        'alipay',
        'is_exchange',
        'coupon',
        'extends',
    ];

    public function activity()
    {
        return $this->belongsTo(Activity::class, 'activity_id');
    }

    public function prize()
    {
        return $this->belongsTo(Prize::class, 'prize_id');
    }

    public function logistics()
    {
        return $this->hasOne(PrizeLogistics::class, 'record_id', 'id');
    }
}
